import { createRouter, createWebHistory } from 'vue-router';
import type { RouteRecordRaw } from 'vue-router';
import PlayListDetail from '@/components/PlayList/PlayListDetail.vue'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'Home',
    component: () => import('@/views/Home.vue')
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('@/views/Search.vue')
  },
  {
    path: '/detail/:id?',
    name: 'Detail',
    component: () => import('@/views/Detail.vue'),
    props: true
  },
  {
    path: '/playlist',
    name: 'Playlist',
    component: () => import('@/views/PlayList.vue')
  },
  {
    path: '/library',
    name: 'Library',
    component: () => import('@/views/Library.vue')
  },
  {
    path: '/playlist/:id',
    name: 'playlist-detail',
    component: PlayListDetail
  },
  {
    path: '/resource',
    name: 'Resource',
    component: () => import('@/views/Resource.vue')
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;